package nxu;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

public class filter implements Interceptor{
    @Override
    public void intercept(Invocation invocation) {
        Controller controller = invocation.getController();
        String userName = controller.getCookie("username");
        if(userName!=null){
            invocation.invoke();//放行
        }
        else{
            controller.redirect("/login");//拦截
        }
    }
}
